<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Menu
 *
 * @author maospina
 */
class Menu {
    private $tipusu;
    
    function __construct($tipusu) {
        $this->tipusu = $tipusu;
    }
    
    public function getTipusu() {
        return $this->tipusu;
    }

    public function setTipusu($tipusu) {
        $this->tipusu = $tipusu;
    }

    function mostrarMenu(){
        include_once '../conexion/Conexion.php';
        session_start();
        $con = new Conexion();
        
        $select = "select modulo.mod_oid,mod_descripcion,sub_descripcion,sub_dir
                            from modulo inner join submodulo on modulo.mod_oid=submodulo.mod_oid
                            inner join config on submodulo.sub_oid=config.sub_oid
                            inner join roll on config.rol_oid=roll.rol_oid
                            where roll.rol_oid = '".$this->tipusu."'
                            group by modulo.mod_oid,mod_descripcion,sub_descripcion,sub_dir
                            order by mod_descripcion asc";
        $res = $con->query($select);
        $i = 0;
        while ($res2 = mssql_fetch_array($res)){
            $_SESSION['modulo'.$i] = $res2['mod_descripcion'];
            $_SESSION['submod'.$i] = $res2['sub_descripcion'];
            $_SESSION['dir'.$i] = $res2['sub_dir'];
            $i++;
        }
        $_SESSION['tama'] = $i;
    }

} 

?>
